<?php

namespace App\Models\Common;

use App\Models\Member\Member;
use App\Models\Sys\User;
use Emadadly\LaravelUuid\Uuids;
use WeSoonNet\LaravelPlus\Traits\Timezone;
use Illuminate\Database\Eloquent\Model;

class Process extends Model
{
    use Uuids, Timezone;

    protected $table        = 'com_process';
    protected $guarded      = ['created_at', 'updated_at'];
    protected $hidden       = ['pivot'];
    protected $casts        = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s',
        'deleted_at' => 'datetime:Y-m-d H:i:s',
    ];

    public static $stateArr = [
        0 => '待审核',
        5 => '系统审核通过',
        10 => '人工审核通过',
        -10 => '人工审核不通过',
    ];

    public static $placeArr = [
        1 => '新闻',
        2 => '投票',
        3 => '活动',
        4 => '店铺',
        5 => '推文',
        6 => '用户',
        7 => 'talking',
        8 => '学校',
    ];

    /**
     * 用户
     */
    public function member()
    {
        return $this->belongsTo(Member::class, 'member_uuid', 'uuid');
    }

    //资源
    public function services()
    {
        return $this->hasMany(ProcessService::class, 'process_uuid', 'uuid');
    }
}
